﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using haptic.src.engine;
using haptic.src.engine.collisions;
using Microsoft.Xna.Framework;
using haptic.src.engine.core;

namespace haptic.src.components
{
    [Serializable]
    public class cGameCamera : cCamera
    {
        #region Constructors
        public cGameCamera(){}
        public cGameCamera(Entity oOwner) : base(oOwner){}
        #endregion

        #region Load
        public override Result Load(haptic.src.engine.Scene oScene, Microsoft.Xna.Framework.Content.ContentManager oContent)
        {
            oScene.m_oCollisionManager.AddCollider(m_oLeftCollider, CollisionManager.ColliderFlags.E_DEFAULT);
            return base.Load(oScene, oContent);
        }
        #endregion

        #region Update
        public override void Update(Microsoft.Xna.Framework.GameTime oTime)
        {
            float fMaxX = 400.0f;
            foreach (Entity oPlayer in m_oScene.oPlayers)
            {
                if (oPlayer.m_vPosition.X > fMaxX)
                    fMaxX = oPlayer.m_vPosition.X;
            }
            m_oEntity.m_vPosition.X = fMaxX;
            base.Update(oTime);
        }
        #endregion

        #region Attributes
        private BorderCollider m_oLeftCollider = new BorderCollider(new Vector2(1,0),0);
        #endregion
    }
}
